package com.fenghen.demo01.config;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledConfig {
    @Scheduled(fixedRate = 5000)
    public void performTask() {
        System.out.println("定时任务执行: " + System.currentTimeMillis() / 1000);
    }

    // 每天的固定时间（早上9点执行）
    @Scheduled(cron = "0 0 9 * * ?")
    public void performDailyTask() {
        System.out.println("每日任务执行: " + System.currentTimeMillis() / 1000);
    }
}
